home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Oct 17, 2000
- // Author: cdt
- //
- // Description:
- // This script is the create clip time warp option box
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
-
- proc setOptionVars (int $forceFactorySettings)
- {
- // createClipTimeWarpOptBox:
- // 1 == create an enabled time warp curve
- // 2 == create a disabled time warp curve
- if ($forceFactorySettings ||
- !`optionVar -exists createClipTimeWarpOptBox`) {
- optionVar -intValue createClipTimeWarpOptBox 1;
- }
- }
-
- //
- // Procedure Name:
- // createClipTimeWarpSetup
- //
- // Description:
- // Update the state of the option box UI to reflect the option values.
- //
- // Input Arguments:
- // parent - Top level parent layout of the option box UI.
- // Required so that UI object names can be
- // successfully resolved.
- //
- // forceFactorySettings - Whether the option values should be set to
- // default values.
- //
- // Return Value:
- // None.
- //
- global proc createClipTimeWarpSetup (string $parent, int $forceFactorySettings)
- {
- // Retrieve the option settings.
- setOptionVars( $forceFactorySettings );
-
- setParent $parent;
-
- int $warpEnabled = `optionVar -query createClipTimeWarpOptBox`;
- switch ($warpEnabled) {
- case 1:
- radioButtonGrp -e -sl 1 createClipTimeWarpEnabled;
- break;
- case 2:
- radioButtonGrp -e -sl 1 createClipTimeWarpDisabled;
- break;
- }
- }
-
- //
- // Procedure Name:
- // createClipTimeWarpCallback
- //
- // Description:
- // Update the option values with the current state of the option box UI.
- //
- // Input Arguments:
- // parent - Top level parent layout of the option box UI. Required so
- // that UI object names can be successfully resolved.
- //
- // doIt - Whether the command should execute.
- //
- // clipEd - The name of the Clip Editor.
- //
- // Return Value:
- // None.
- //
- global proc createClipTimeWarpCallback (string $parent,
- int $doIt, string $clipEd)
- {
- setParent $parent;
-
- if (`radioButtonGrp -q -sl createClipTimeWarpEnabled`) {
- optionVar -intValue createClipTimeWarpOptBox 1;
- } else {
- optionVar -intValue createClipTimeWarpOptBox 2;
- }
-
- if ($doIt)
- performCreateClipTimeWarp false $clipEd;
- }
-
-
- proc string createClipTimeWarpWidgets( string $parent )
- {
- setParent $parent;
-
- string $tabForm = `columnLayout -adj true`;
-
- radioButtonGrp -numberOfRadioButtons 1
- -label "Time Warp"
- -label1 "Enabled Time Warp Curve"
- createClipTimeWarpEnabled;
-
- radioButtonGrp -numberOfRadioButtons 1
- -label1 "Disabled Time Warp Curve"
- -shareCollection createClipTimeWarpEnabled
- createClipTimeWarpDisabled;
-
- return $tabForm;
- }
-
- global proc createClipTimeWarpOptions (string $clipEd)
- {
- string $commandName = "createClipTimeWarp";
-
- // Build the option box "methods"
- //
- string $callback = ($commandName + "Callback");
- string $setup = ($commandName + "Setup");
-
- // Get the option box.
- //
- // The value returned is the name of the layout to be used as
- // the parent for the option box UI.
- //
- string $layout = getOptionBox();
- setParent $layout;
-
- setOptionBoxCommandName($commandName);
-
- setUITemplate -pushTemplate DefaultTemplate;
- waitCursor -state 1;
- tabLayout -scr true -tv false; // To get the scroll bars
-
- string $parent = `columnLayout -adjustableColumn 1`;
-
- createClipTimeWarpWidgets $parent;
-
- waitCursor -state 0;
- setUITemplate -popTemplate;
-
- // 'Apply' button.
- //
- string $applyBtn = getOptionBoxApplyBtn();
- button -edit
- -label "Create Time Warp"
- -command ($callback + " " + $parent + " " + 1 + " \"" + $clipEd + "\"")
- $applyBtn;
-
- // 'Save' button.
- //
- string $saveBtn = getOptionBoxSaveBtn();
- button -edit
- -command ($callback + " " + $parent + " " + 0 + "\"" + $clipEd + "\"; hideOptionBox")
- $saveBtn;
-
- // 'Reset' button.
- //
- string $resetBtn = getOptionBoxResetBtn();
- button -edit
- -command ($setup + " " + $parent + " " + 1)
- $resetBtn;
-
- // Set the option box title.
- //
- setOptionBoxTitle("Clip Time Warp Options");
-
- // Customize the 'Help' menu item text.
- //
- setOptionBoxHelpTag( "TimeWarp" );
-
- // Set the current values of the option box.
- //
- eval (($setup + " " + $parent + " " + 0));
-
- // Show the option box.
- //
- showOptionBox();
- }
-
- //
- // Procedure Name:
- // assembleCmd
- //
- // Description:
- // Construct the command that will apply the option box values.
- //
- // Input Arguments:
- // The name of the clip editor used to call this option box.
- //
- // Return Value:
- // None.
- //
- proc string assembleCmd(string $clipEd)
- {
- string $cmd;
-
- setOptionVars(false);
-
- int $enableWarp = true;
- if (`optionVar -query createClipTimeWarpOptBox` != 1) {
- $enableWarp = false;
- }
-
- if (size($clipEd) == 0) {
- error ("Could not find the clipEditor.");
- }
-
- string $selected[] = `clipEditor -q -sc $clipEd`;
- int $nSelected = size($selected);
- if ($nSelected < 2) {
- error ("Select a clip for time warp creation.");
- }
-
- string $clipArray = "{";
-
- int $ii = 0;
- int $nAdded = 0;
- string $pre = "";
- for ($ii = 0; $ii < $nSelected; $ii++) {
- string $scheduler = $selected[$ii++];
- int $index = $selected[$ii];
-
- string $clip = `clipSchedule -ci $index -q -n $scheduler`;
- if (size($clip) == 0) {
- continue;
- }
-
- if ($nAdded++ > 0) {
- $pre = ",";
- }
- $clipArray += ($pre+"\"" + $clip + "\"");
- }
-
- $clipArray += "}";
-
- string $cmd =
- ("doCreateClipTimeWarp( "+$clipArray+", "+$enableWarp+");");
-
- return $cmd;
- }
-
- //
- // Procedure Name:
- // performCreateClipTimeWarp
- //
- // Description:
- // Adds a time warp curve to the clip.
- //
- // Input Arguments:
- // 0 - Execute the command.
- // 1 - Show the option box dialog.
- // 2 - Return the command.
- //
- // Return Value:
- // None.
- //
- global proc string performCreateClipTimeWarp (int $action, string $clipEd)
- {
- string $cmd = "";
-
- switch ($action) {
-
- // Execute the command.
- //
- case 0:
- // Retrieve the option settings
- //
- setOptionVars(false);
-
- // Get the command.
- //
- $cmd = `assembleCmd($clipEd)`;
-
- // Execute the command with the option settings.
- //
- if ($cmd != "")
- eval($cmd);
- break;
-
- // Show the option box.
- //
- case 1:
- createClipTimeWarpOptions($clipEd);
- break;
- case 2:
- // Get the command.
- //
- $cmd = `assembleCmd($clipEd)`;
- }
- return $cmd;
- }
-
-